<!DOCTYPE>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript" src="../jquery-3.6.0.min.js" charset="UTF-8"></script>
		<script type="text/javascript">
		function add(){
			let username=$("#username").val();
			let sex=$("#sex").val();
			let state=$("#state").val();
			let house=$("#house").val();
			let number=$("#number").val();
			
			let count=$("tbody>tr").length +1;
			
			let rowItem =  `<tr>
			<td>${count}</td>
			<td>${username}</td>
			<td>${sex}</td>
			<td>${state}</td>
			<td>${house}</td>
			<td>${number}</td>
			<td><button  type="button" onclick="del(this) ">删除</button></td>
			</tr>`
			$("tbody").append(rowItem);
		}
		function del(btn){
			$(btn).parent().parent().remove();
		}
	</script>
	</head>
	<body>
		<form>
			姓名：<input type="text" name=" " id="username" value=" "/><br />
			性别：<input type="text" name=" " id="sex" value=" "/><br />
			身份证号：<input type="text" name=" " id="state" value=" "/><br />
			房间号：<input type="text" name=" " id="house" value=" "/><br />
			入住人数：<input type="text" name=" " id="number" value=" "/><br />
			<button type="button"  onclick="add()">添加</button>
		</form>
		
		
		<table border="1px" cellpadding="0" cellspacing="0">
			<thead>
				<th>序号</th>
				<th>姓名</th>
				<th>性别</th>
				<th>身份证号</th>
				<th>房间号</th>
				<th>入住人数</th>
				<th>操作</th>
			</thead>
			<tbody>
		
			</tbody>
		</table>
	</body>
</html>
